//
//  LWDefaultView.m
//  1.28  weibo
//
//  Created by mac on 15/2/1.
//  Copyright (c) 2015年 mac. All rights reserved.
//

#import "LWDefaultView.h"




@interface LWDefaultView ()

@property (weak, nonatomic) IBOutlet UILabel *describtion;
@property (weak, nonatomic) IBOutlet UIImageView *tuBiao;
- (IBAction)loginClick:(UIButton *)sender;
- (IBAction)registClick:(UIButton *)sender;

@property (weak, nonatomic) IBOutlet UIButton *login;
@property (weak, nonatomic) IBOutlet UIButton *registBtn;
@property (nonatomic,strong) CADisplayLink *link;

@end


@implementation LWDefaultView
+ (instancetype)defaultView{

    return [[[NSBundle mainBundle] loadNibNamed:@"LWDefaultView" owner:nil options:nil] lastObject];
}

- (void)setIcon:(NSString *)icon{

    self.tuBiao.image = [UIImage imageNamed:icon];
}
- (void)setContent:(NSString *)content{

    self.describtion.text = content;
}

- (IBAction)loginClick:(UIButton *)sender {
    
    if ([self.deledate respondsToSelector:@selector(defaultView:didClickLogin:)]) {
        [self.deledate defaultView:self didClickLogin:sender];
    }
    
}

- (IBAction)registClick:(UIButton *)sender {
    
    if ([self.deledate respondsToSelector:@selector(defaultView:didClickRegist:)]) {
        [self.deledate defaultView:self didClickRegist:sender];
    }
}

- (void)startRotate{
    
    [self.link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
}

- (void)stopRotate{
    [self.link invalidate];
    self.link = nil;
}
- (void)updata{
    
   self.zhuanPan.transform = CGAffineTransformRotate(self.zhuanPan.transform, (M_PI) * 0.001);
}
#pragma mark - 懒加载link
- (CADisplayLink *)link{

    if (_link == nil) {
        _link = [CADisplayLink displayLinkWithTarget:self selector:@selector(updata)];
    }
    return _link;
}

@end
